﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using System.IO;

namespace Tank.Draw
{
    public class DrawStart
    {
        private Bitmap bit;
        private Graphics g;
        public DrawStart(int x, int y)
        {
            bit = new Bitmap(x, y);
            g = Graphics.FromImage(bit);
        }


        public Bitmap getBitmap()
        {
            Draw();
            return bit;
        }

        private void Draw()
        {
            //画头
            Image i = Image.FromFile(Directory.GetCurrentDirectory()+@"\Image\title.gif");
            Point p = new Point();
            p.X = (bit.Width - i.Width) / 2;
            p.Y = 100;
            g.DrawImage(i, p);
            //画选择背景
            Image select = Image.FromFile(Directory.GetCurrentDirectory()+@"\Image\select.gif");
            p.X = (bit.Width - select.Width) / 2;
            p.Y = 150 + i.Height;
            g.DrawImage(select, p);
            //画选择的坦克
            Image selectTank = Image.FromFile(Directory.GetCurrentDirectory()+@"\Image\selecttank.gif");
            p.X = p.X - 55;
            p.Y = p.Y + (65 * (int)Data.indexselectTankState)-5;
            g.DrawImage(selectTank, p);
        }
    }
}
